package com.yy.finvideoplayer.model

/**
 * @Description: QSVideo
 * @Author: yiw89
 * @CreateDate: 2025/9/1 15:15
 * @Version: 1.0
 */
class QSVideo {
    private lateinit var url: String
    private var title: String? = null

    private var definition: String? = null
    private var resolution: String? = null
    private var headers: Map<String, String>? = null
    private var option: Any? = null


    fun url(): String {
        return url
    }

    fun title(): String? {
        return title
    }

    fun definition(): String? {
        return definition
    }

    fun resolution(): String? {
        return resolution
    }

    fun headers(): Map<String, String>? {
        return headers
    }

    fun option(): Any? {
        return option
    }

    class Builder internal constructor(private var url: String) {
        private var title: String? = null

        private var definition: String? = null
        private var resolution: String? = null
        private var headers: Map<String, String>? = null
        private var option: Any? = null

        fun build(): QSVideo {
            val qsVideo = QSVideo()
            qsVideo.url = url
            qsVideo.title = title
            qsVideo.definition = definition
            qsVideo.resolution = resolution
            qsVideo.headers = headers
            qsVideo.option = option
            return qsVideo
        }

        fun url(url: String): Builder {
            this.url = url
            return this
        }

        fun title(title: String?): Builder {
            this.title = title
            return this
        }

        fun definition(definition: String?): Builder {
            this.definition = definition
            return this
        }

        fun resolution(resolution: String?): Builder {
            this.resolution = resolution
            return this
        }

        fun headers(headers: Map<String, String>?): Builder {
            this.headers = headers
            return this
        }

        fun option(option: Any?): Builder {
            this.option = option
            return this
        }
    }

    companion object {
        fun Build(url: String): Builder {
            return Builder(url)
        }
    }
}
